package l06_permutations;

/**
 * 将人民币组合成100元，有多少中组合方式.
 *
 * @author wangxiyue@cyou-inc.com
 * @date 2019-08-15
 * @since 1.0.0
 */
public class Money {

    public static void main(String[] args) {
        combine(5, 0);
    }

    static int[] money = {1, 2, 5, 10, 20, 50, 100};

    private static int combine(int lump, int num) {
        for (int i : money) {
            if (0 > lump - i) {
                break;
            } else if (0 == lump - i) {
                System.out.println(num + 1);
//                return num + 1;
            } else {
                combine(lump - i, num + 1);
            }
        }
        return 0;
    }


}
